package com.sky.controller.admin;

import com.sky.dto.OrdersPageQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.OrderService;
import com.sky.vo.OrderStatisticsVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单
 */
@RestController("adminOrderController")
@RequestMapping("/admin/order")
@Slf4j
@Api(tags = "管理端订单接口")
public class OrderController {

    @Autowired
    private OrderService orderService;


    /**
     * 管理端 订单查询
     * @param dto
     * @return
     */
    @GetMapping("/conditionSearch")
    public Result<PageResult> historyOrders(OrdersPageQueryDTO dto){
        PageResult pageResult =orderService.conditionSearch(dto);
        return Result.success(pageResult);
    }


    /**
     * 数量统计
     */
    @GetMapping("/statistics")
    public Result<OrderStatisticsVO> statistics(){
        OrderStatisticsVO vo=orderService.statistics();
        return Result.success(vo);
    }


}
